/**
 * This class read the circuit in serialization.
 * 
 * @author Gregory Banfi (gregory.banfi@usi.ch);
 * @version 24.05.2011
 */

package ch.usi.inf.pf2;

import java.io.ObjectInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;

public class ReadCircuit {

	public ArrayList<Component> components;

	@SuppressWarnings("unchecked")
	public ReadCircuit(String path) {

		components = new ArrayList<Component>();
		FileInputStream fis = null;
		ObjectInputStream in = null;
		try {
			fis = new FileInputStream(path);
			in = new ObjectInputStream(fis);
			components = (ArrayList<Component>) in.readObject();
			in.close();
		} catch (IOException ex) {
			ex.printStackTrace();
		} catch (ClassNotFoundException ex) {
			ex.printStackTrace();
		}
	}
}
